/*
    simplecookbook  -  simplecookbook.receitas.IRepositorioReceitas.java
                             -------------------
    begin                : 08/10/2008
    copyright            : (C) 2008 by cristovao
    email                : cristovao.wollieson@gmail.com
 ***************************************************************************/

/*
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful, but   *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,   *
 *   MA  02111-1307 USA                                                    *
 ***************************************************************************/

/**
 * Pacote responsavel pelo controle de receitas do sistema
 * 
 * @author cristovao
 */
package org.ybacoby.simplecookbook.database;

import java.util.ArrayList;

import org.ybacoby.simplecookbook.exception.SimpleCookBookException;



/**
 * @author cristovao
 * Interface para controle de itens no banco de dados
 */
public interface IRepositorioDatabase<T> {

	/**
	 * Adiciona um novo item ao banco de dados
	 * 
	 * @param obj Item a ser adicionada
	 * @throws SimpleCookBookException Caso ocorra um erro de sql
	 */
	public void adicionar(T obj) throws SimpleCookBookException;
	
	/**
	 * Altera uma dada receita no banco de dados
	 * 
	 * @param obj Item a ser alterada
	 * @throws SimpleCookBookException Caso nao tenha o codigo da receita
	 */
	public void alterar(T obj) throws SimpleCookBookException;
	
	/**
	 * Exclui um item do banco de dados
	 * 
	 * @param obj Item a ser excluida
	 * @throws SimpleCookBookException Caso a receita seja ausente de codigo
	 */
	public void excluir(T obj) throws SimpleCookBookException;
	
	/**
	 * Serve para procurar itens no banco de dados
	 * 
	 * @param obj Um array de itens ou receitas que sera buscada
	 * @return Um array de receitas encontradas
	 * @throws SimpleCookBookException Caso ocorra erro no sql
	 */
	public ArrayList<T> procurar(T obj) throws SimpleCookBookException;
	
	/**
	 * Retorna o numero de itens no repositorio
	 * 
	 * @return Um valor inteiro de receitas no repositorio
	 * @throws SimpleCookBookException Caso ocorra algum erro no repositorio
	 */
	public int totalItens() throws SimpleCookBookException;
}
